<!DOCTYPE html>
<html class=" js csstransforms3d">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>文章发布-发布</title>
    <link rel="stylesheet" href="/static/css/base.css">
    <link rel="stylesheet" href="/static/css/page.css">

    <script type="text/javascript" src="/static/js/jquery.min.js"></script>
    <script type="text/javascript" src="/static/js/main.js"></script>
    <script type="text/javascript" src="/static/js/modernizr.js"></script>
    <script type="text/javascript" src="/static/js/jquery.selectui.js"></script>

    <script type="text/javascript" charset="utf-8" src="/static/js/utf8-jsp/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/static/js/utf8-jsp/ueditor.all.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/static/js/utf8-jsp/lang/zh-cn/zh-cn.js"></script>

    <link rel="stylesheet" type="text/css" href="/static/js/webuploader/webuploader.css">
    <link rel="stylesheet" type="text/css" href="/static/js/webuploader/demo.css">

    <script>
        $(function ($) {
            $("select").selectui({
                // 是否自动计算宽度
                autoWidth: true,

                // 是否启用定时器刷新文本和宽度
                interval: true
            });
        });
    </script>

    <link href="/static/js/utf8-jsp/themes/default/css/ueditor.css" type="text/css" rel="stylesheet">
    <script src="/static/js/utf8-jsp/third-party/codemirror/codemirror.js" type="text/javascript" defer></script>
    <link rel="stylesheet" type="text/css" href="/static/js/utf8-jsp/third-party/codemirror/codemirror.css">
    <script src="/static/js/utf8-jsp/third-party/zeroclipboard/ZeroClipboard.js" type="text/javascript" defer></script>
</head>

<body style="background: rgb(246, 245, 250);">
<!--content S-->
<div class="super-content">

    <div class="superCtab">
        <div class="publishArt">
            <h4>发布文章</h4>
            <div class="pubMain">
                <a href="{% url 'App:main' %}" class="backlistBtn"><i class="ico-back"></i>返回列表</a>
                <form action="{% url 'ArticleManage:publish' cid=cid %}" method="post" enctype="multipart/form-data">
                    {% csrf_token %}
                    <input type="hidden" name="cid" value="{{ cid }}">
                    <h5 class="pubtitle">文章标题</h5>
                    <div class="pub-txt-bar">
                        <input type="text" class="shuruTxt" name="title" required autofocus autocomplete="off"><br>
                        {{ error }}
                    </div>

                    <h5 class="pubtitle">发布期刊</h5>
                    <div class="pub-txt-bar">
                        <input type="text" class="shuruTxt" name="resource" required autocomplete="off">
                    </div>
                    <h5 class="pubtitle">上传文件</h5>

                    <div class="Thumbnails clearfix">
                        <div class="Thumblist" id="preview">
                           <div class="Thumblistbg upload-img">
                            <input id="photo" type="file"  size="30" name="photo">
                            <a href="javascript:;" class="Thumbbtn"><i class="ico-download"></i>上传文件</a>
                        </div>

                        </div>

                    </div>

                    <h5 class="pubtitle">作者</h5>
                    <div class="pub-area-bar">
                        <textarea name="anthor" rows="" cols="3" required></textarea>
                    </div>
                    <h5 class="pubtitle">文章内容</h5>
                    <div class="pub-area-bar">
                        <textarea name="contend" rows="" cols="3" id="editor"></textarea>

                    </div>
                    <div class="pub-btn">
                        <input type="submit" id="publish_article" value="确定" class="saveBtn">
                    </div>
                </form>

            </div>
        </div>

    </div>


</div>


<script type="text/javascript">
    // 添加全局站点信息
    var BASE_URL = '/webuploader';
</script>

<script type="text/javascript">

    var ue = UE.getEditor('editor',{
        initialFrameHeight: 300,
    });


    function isFocus(e) {
        alert(UE.getEditor('editor').isFocus());
        UE.dom.domUtils.preventDefault(e)
    }

    function setblur(e) {
        UE.getEditor('editor').blur();
        UE.dom.domUtils.preventDefault(e)
    }



    function createEditor() {
        enableBtn();
        UE.getEditor('editor');
    }


    function getContent() {
        var arr = [];
        arr.push("使用editor.getContent()方法可以获得编辑器的内容");
        arr.push("内容为：");
        arr.push(UE.getEditor('editor').getContent());
        alert(arr.join("\n"));
    }

    function setDisabled() {
        UE.getEditor('editor').setDisabled('fullscreen');
        disableBtn("enable");
    }

    function setEnabled() {
        UE.getEditor('editor').setEnabled();
        enableBtn();
    }



    function setFocus() {
        UE.getEditor('editor').focus();
    }

    function deleteEditor() {
        disableBtn();
        UE.getEditor('editor').destroy();
    }

    function disableBtn(str) {
        var div = document.getElementById('btns');
        var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
        for (var i = 0, btn; btn = btns[i++];) {
            if (btn.id == str) {
                UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
            } else {
                btn.setAttribute("disabled", "true");
            }
        }
    }

    function enableBtn() {
        var div = document.getElementById('btns');
        var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
        for (var i = 0, btn; btn = btns[i++];) {
            UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
        }
    }

    function getLocalData() {
        alert(UE.getEditor('editor').execCommand("getlocaldata"));
    }

    function clearLocalData() {
        UE.getEditor('editor').execCommand("clearlocaldata");
        alert("已清空草稿箱")
    }


</script>

</body>
</html>